<template>
  <div class="components-container">
    <el-drag-select v-model="value" style="width:500px;" multiple placeholder="请选择">
      <el-option v-for="item in tagList" :key="item.id" :label="item.tag_name" :value="item.tag_id" />
    </el-drag-select>

    <div style="margin-top:30px;">
      <el-tag v-for="item of value" :key="item" style="margin-right:15px;">
        {{ item }}
      </el-tag>
    </div>
  </div>
</template>

<script>
import ElDragSelect from '@/components/DragSelect' // base on element-ui
import { mapGetters, mapActions } from 'vuex'

export default {
  name: 'TagSelect',
  components: { ElDragSelect },
  data() {
    return {
      value: ['Apple', 'Banana', 'Orange'],
      options: [{
        value: 'Apple',
        label: 'Apple'
      }, {
        value: 'Banana',
        label: 'Banana'
      }, {
        value: 'Orange',
        label: 'Orange'
      }, {
        value: 'Pear',
        label: 'Pear'
      }, {
        value: 'Strawberry',
        label: 'Strawberry'
      }]
    }
  },
  mounted() {
    // console.log("mounted this.listQuery :",this.listQuery);
    this.getList();
  },
  computed: {
    ...mapGetters(['tagList'])
  },
  methods: {
    ...mapActions(['getTagList']),
    getList() {
      this.getTagList()
    },
  }
}
</script>
